<script setup>
import { ref } from 'vue'
import { getProList } from './api/homeapi'

const proList = ref([])
const page = ref(0)
getProList({
  page: page.value
}).then(res => {
  proList.value = res
})


function pageClick (code) {
  page.value = code == '-' ? page.value - 1 : page.value + 1
  // page.value++


  getProList({
    page: page.value
  }).then(res => {
    proList.value = res
  })
}

</script>

<template>
  <div>
    <el-table :data="proList" style="width: 100%">
      <el-table-column prop="createTime" label="添加时间" />
      <el-table-column prop="proname" label="商品名称" />
      <el-table-column prop="goodsKind" label="分类" />
      <el-table-column prop="proStart" label="星级" />
      <el-table-column label="操作">
        <template #default>
          <el-button type="primary">修改</el-button>
          <el-button type="success">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-button type="primary" @click="pageClick('-')">上一页</el-button>
    <el-button type="primary" @click="pageClick('+')">下一页</el-button>

  </div>
</template>
